﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DangKi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnDK_Click(object sender, EventArgs e)
    {
        try
        {
            UserDTO ndDTO = new UserDTO();
            ndDTO.Username = txtTK.Text.Trim();
            ndDTO.Pass = txtMK.Text.Trim();
            ndDTO.Mail = txtMail.Text.Trim();

            bool ktra = UserBUS.ktraTonTai(ndDTO);

            if (!ktra)
            {
                UserBUS.themUser(ndDTO);
               
                 lblThongBao.Text = "REGISTRATION SUCCESS";

            }
            else
            {
                lblThongBao.Text = "Account already exists";
            }
        }
        catch (Exception ex)
        {

            Console.WriteLine("\nMessage ---\n{0}", ex.Message);
        }
    }
    //protected void btnreset_Click(object sender, EventArgs e)
    //{
    //    txtTK.Text = "";
    //    txtMK.Text = "";
    //    txtMail.Text = "";
    //}
}